package server.Example;

import com.core.async.AsyncServiceImpl;
import com.core.async.IAsyncService;
import com.core.interfaces.IMessageExecutorPool;
import com.core.thread.OneMessageExecutorPool;

/**
 * 异步线程回调范例
 * 将一件事情 回家了
 * @author King
 *
 */
public class AsyncExample implements Runnable
{
	/**异步线程回调服务**/
	protected static IAsyncService asyncService = new AsyncServiceImpl();
	
	public static void main(String[] args)
	{
		IMessageExecutorPool pool = new OneMessageExecutorPool();
		AsyncExample example = new AsyncExample();
		asyncService.init(pool, 10);
		pool.pushAction(example);
		
	}

	@Override
	public void run() {
		SyncWork work =new SyncWork();
		asyncService.addAsyncBackWork(work, "doSyncWork", 55);
	}
	
	
}
